#include "power_utils.h"
#define DEVICE_CHANNEL_1     510
#define DEVICE_CHANNEL_2     502
#define DEVICE_CHANNEL_3     503
#define DEVICE_CHANNEL_4     504
#define DEVICE_CHANNEL_5     505

/**
 * 控制指定通道设备
 */
void controle_cannel(int channel, char *val){
    char cmd_str[100] = {0};
    switch (channel)
    {
    case 1:
        sprintf(cmd_str, "sh /bin/power_control.sh %d %s", DEVICE_CHANNEL_1, val);
        break;
    case 2:
        sprintf(cmd_str, "sh /bin/power_control.sh %d %s", DEVICE_CHANNEL_2, val);
        break;
    case 3:
        sprintf(cmd_str, "sh /bin/power_control.sh %d %s", DEVICE_CHANNEL_3, val);
        break;
    case 4:
        sprintf(cmd_str, "sh /bin/power_control.sh %d %s", DEVICE_CHANNEL_4, val);
        break;
    case 5:
        sprintf(cmd_str, "sh /bin/power_control.sh %d %s", DEVICE_CHANNEL_5, val);
        break;
    }
    printf("%s\n", cmd_str);
    system(cmd_str);
}
/**
 * 控制指定通道设备
 */
void network_sleep(){
    char *cmd_str = "sh /bin/network_sleep.sh";
    system(cmd_str);
}
/**
 * 控制指定通道设备
 */
void network_wake(){
    char *cmd_str = "sh /bin/network_wake.sh";
    system(cmd_str);
}
void device_reboot() {
    system("reboot");
}
void device_config(char *url) {
    char cmd_str[512];
    sprintf(cmd_str, "sh /bin/command.sh %s", url);
    printf("%s\n", cmd_str);
    system(cmd_str);
}

